/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package persistencia
import groovy.sql.Sql;
import org.postgresql.jdbc2.optional.ConnectionPool;


    
//def dataSource = new ConnectionPool();
//dataSource.setDatabaseName("tcc");
//dataSource.setPassword("tcc");
//dataSource.setUser("tcc");
//dataSource.setPortNumber(5432);
//dataSource.setServerName("localhost");

def sql = Sql.newInstance("jdbc:postgresql://localhost:5432/tcc", "tcc",
                      "tcc", "org.postgresql.Driver")
  //def sql = new groovy.sql.Sql(dataSource)

def name='André'

//sql.eachRow("select * from contas_a_receber.tcidade_cep where tuf = 'BA'") {
  //  println "Linha: ${it.tcidade_cep}"
//}
def ds = sql.dataSet('contas_a_receber.tcidade_cep')

def x = ds.rows()
over_2 = x.findAll {it.tuf = 'BA' }
over_2.each { println it }

println "André"

return "Bingo"
